3.1.11 \(\int \frac {\cos (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx\) [11]

3.1.11.1 Optimal result
3.1.11.2 Mathematica [A] (verified)
3.1.11.3 Rubi [A] (verified)
3.1.11.4 Maple [A] (verified)
3.1.11.5 Fricas [A] (verification not implemented)
3.1.11.6 Sympy [B] (verification not implemented)
3.1.11.7 Maxima [F(-2)]
3.1.11.8 Giac [A] (verification not implemented)
3.1.11.9 Mupad [B] (verification not implemented)

3.1.11.1 Optimal result

Integrand size = 17, antiderivative size = 35 \[ \int \frac {\cos (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=-\frac {2 \text {arctanh}\left (\frac {b+2 c \sin (x)}{\sqrt {b^2-4 a c}}\right )}{\sqrt {b^2-4 a c}} \]

output
-2*arctanh((b+2*c*sin(x))/(-4*a*c+b^2)^(1/2))/(-4*a*c+b^2)^(1/2)
 
3.1.11.2 Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.00 \[ \int \frac {\cos (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=-\frac {2 \text {arctanh}\left (\frac {b+2 c \sin (x)}{\sqrt {b^2-4 a c}}\right )}{\sqrt {b^2-4 a c}} \]

input
Integrate[Cos[x]/(a + b*Sin[x] + c*Sin[x]^2),x]
 
output
(-2*ArcTanh[(b + 2*c*Sin[x])/Sqrt[b^2 - 4*a*c]])/Sqrt[b^2 - 4*a*c]
 
3.1.11.3 Rubi [A] (verified)

Time = 0.21 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.235, Rules used = {3042, 3739, 1083, 219}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\cos (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\cos (x)}{a+b \sin (x)+c \sin (x)^2}dx\)

\(\Big \downarrow \) 3739

\(\displaystyle \int \frac {1}{a+b \sin (x)+c \sin ^2(x)}d\sin (x)\)

\(\Big \downarrow \) 1083

\(\displaystyle -2 \int \frac {1}{b^2-(b+2 c \sin (x))^2-4 a c}d(b+2 c \sin (x))\)

\(\Big \downarrow \) 219

\(\displaystyle -\frac {2 \text {arctanh}\left (\frac {b+2 c \sin (x)}{\sqrt {b^2-4 a c}}\right )}{\sqrt {b^2-4 a c}}\)

input
Int[Cos[x]/(a + b*Sin[x] + c*Sin[x]^2),x]
 
output
(-2*ArcTanh[(b + 2*c*Sin[x])/Sqrt[b^2 - 4*a*c]])/Sqrt[b^2 - 4*a*c]
 

3.1.11.3.1 Defintions of rubi rules used

rule 219
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))* 
ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (Gt 
Q[a, 0] || LtQ[b, 0])
 

rule 1083
Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Simp[-2   Subst[I 
nt[1/Simp[b^2 - 4*a*c - x^2, x], x], x, b + 2*c*x], x] /; FreeQ[{a, b, c}, 
x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3739
Int[cos[(d_.) + (e_.)*(x_)]^(m_.)*((a_.) + (b_.)*((f_.)*sin[(d_.) + (e_.)*( 
x_)])^(n_.) + (c_.)*((f_.)*sin[(d_.) + (e_.)*(x_)])^(n2_.))^(p_.), x_Symbol 
] :> Module[{g = FreeFactors[Sin[d + e*x], x]}, Simp[g/e   Subst[Int[(1 - g 
^2*x^2)^((m - 1)/2)*(a + b*(f*g*x)^n + c*(f*g*x)^(2*n))^p, x], x, Sin[d + e 
*x]/g], x]] /; FreeQ[{a, b, c, d, e, f, n, p}, x] && EqQ[n2, 2*n] && Intege 
rQ[(m - 1)/2]
 
3.1.11.4 Maple [A] (verified)

Time = 0.52 (sec) , antiderivative size = 36, normalized size of antiderivative = 1.03

method result size
derivativedivides \(\frac {2 \arctan \left (\frac {b +2 \sin \left (x \right ) c}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}}\) \(36\)
default \(\frac {2 \arctan \left (\frac {b +2 \sin \left (x \right ) c}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}}\) \(36\)
risch \(-\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {i \left (b \sqrt {-4 a c +b^{2}}-4 a c +b^{2}\right ) {\mathrm e}^{i x}}{c \sqrt {-4 a c +b^{2}}}-1\right )}{\sqrt {-4 a c +b^{2}}}+\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {i \left (b \sqrt {-4 a c +b^{2}}+4 a c -b^{2}\right ) {\mathrm e}^{i x}}{c \sqrt {-4 a c +b^{2}}}-1\right )}{\sqrt {-4 a c +b^{2}}}\) \(125\)

input
int(cos(x)/(a+b*sin(x)+c*sin(x)^2),x,method=_RETURNVERBOSE)
 
output
2/(4*a*c-b^2)^(1/2)*arctan((b+2*sin(x)*c)/(4*a*c-b^2)^(1/2))
 
3.1.11.5 Fricas [A] (verification not implemented)

Time = 0.35 (sec) , antiderivative size = 139, normalized size of antiderivative = 3.97 \[ \int \frac {\cos (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\left [\frac {\log \left (-\frac {2 \, c^{2} \cos \left (x\right )^{2} - 2 \, b c \sin \left (x\right ) - b^{2} + 2 \, a c - 2 \, c^{2} + \sqrt {b^{2} - 4 \, a c} {\left (2 \, c \sin \left (x\right ) + b\right )}}{c \cos \left (x\right )^{2} - b \sin \left (x\right ) - a - c}\right )}{\sqrt {b^{2} - 4 \, a c}}, -\frac {2 \, \sqrt {-b^{2} + 4 \, a c} \arctan \left (-\frac {\sqrt {-b^{2} + 4 \, a c} {\left (2 \, c \sin \left (x\right ) + b\right )}}{b^{2} - 4 \, a c}\right )}{b^{2} - 4 \, a c}\right ] \]

input
integrate(cos(x)/(a+b*sin(x)+c*sin(x)^2),x, algorithm="fricas")
 
output
[log(-(2*c^2*cos(x)^2 - 2*b*c*sin(x) - b^2 + 2*a*c - 2*c^2 + sqrt(b^2 - 4* 
a*c)*(2*c*sin(x) + b))/(c*cos(x)^2 - b*sin(x) - a - c))/sqrt(b^2 - 4*a*c), 
 -2*sqrt(-b^2 + 4*a*c)*arctan(-sqrt(-b^2 + 4*a*c)*(2*c*sin(x) + b)/(b^2 - 
4*a*c))/(b^2 - 4*a*c)]
 
3.1.11.6 Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 99 vs. \(2 (36) = 72\).

Time = 1.49 (sec) , antiderivative size = 99, normalized size of antiderivative = 2.83 \[ \int \frac {\cos (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\begin {cases} \frac {\log {\left (\frac {a}{b} + \sin {\left (x \right )} \right )}}{b} & \text {for}\: c = 0 \\- \frac {2}{b + 2 c \sin {\left (x \right )}} & \text {for}\: a = \frac {b^{2}}{4 c} \\\frac {\log {\left (\frac {b}{2 c} + \sin {\left (x \right )} - \frac {\sqrt {- 4 a c + b^{2}}}{2 c} \right )}}{\sqrt {- 4 a c + b^{2}}} - \frac {\log {\left (\frac {b}{2 c} + \sin {\left (x \right )} + \frac {\sqrt {- 4 a c + b^{2}}}{2 c} \right )}}{\sqrt {- 4 a c + b^{2}}} & \text {otherwise} \end {cases} \]

input
integrate(cos(x)/(a+b*sin(x)+c*sin(x)**2),x)
 
output
Piecewise((log(a/b + sin(x))/b, Eq(c, 0)), (-2/(b + 2*c*sin(x)), Eq(a, b** 
2/(4*c))), (log(b/(2*c) + sin(x) - sqrt(-4*a*c + b**2)/(2*c))/sqrt(-4*a*c 
+ b**2) - log(b/(2*c) + sin(x) + sqrt(-4*a*c + b**2)/(2*c))/sqrt(-4*a*c + 
b**2), True))
 
3.1.11.7 Maxima [F(-2)]

Exception generated. \[ \int \frac {\cos (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\text {Exception raised: ValueError} \]

input
integrate(cos(x)/(a+b*sin(x)+c*sin(x)^2),x, algorithm="maxima")
 
output
Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(4*a*c-b^2>0)', see `assume?` for 
 more deta
 
3.1.11.8 Giac [A] (verification not implemented)

Time = 0.31 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.00 \[ \int \frac {\cos (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\frac {2 \, \arctan \left (\frac {2 \, c \sin \left (x\right ) + b}{\sqrt {-b^{2} + 4 \, a c}}\right )}{\sqrt {-b^{2} + 4 \, a c}} \]

input
integrate(cos(x)/(a+b*sin(x)+c*sin(x)^2),x, algorithm="giac")
 
output
2*arctan((2*c*sin(x) + b)/sqrt(-b^2 + 4*a*c))/sqrt(-b^2 + 4*a*c)
 
3.1.11.9 Mupad [B] (verification not implemented)

Time = 15.68 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.34 \[ \int \frac {\cos (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\frac {2\,\mathrm {atan}\left (\frac {b}{\sqrt {4\,a\,c-b^2}}+\frac {2\,c\,\sin \left (x\right )}{\sqrt {4\,a\,c-b^2}}\right )}{\sqrt {4\,a\,c-b^2}} \]

input
int(cos(x)/(a + c*sin(x)^2 + b*sin(x)),x)
 
output
(2*atan(b/(4*a*c - b^2)^(1/2) + (2*c*sin(x))/(4*a*c - b^2)^(1/2)))/(4*a*c 
- b^2)^(1/2)